import storage from 'store'
import { Tp_proctypeEnum } from '@/enumeration/Tp_proctype'
import { APP_USER,APP_DEPT} from '@/store/mutation-types'

export const CaseHandleDecisionMixin = {
  // 当前页面注入路由重加载
  inject: ['reload'],
  props: {
    applyid: {
      type: String,
      required: true,
    },
    proctype: {
      type: String,
      required: true,
    },
    processinstanceid: {
      type: String,
      required: false,
    },
    decisionType: {
      type: Number,
      required: true,
    },
    reason: {
      type: String,
      required: false
    }
  },
  data() {
    return {
      labelCol: { span: 4 }, // label宽
      wrapperCol: { span: 20 }, // 组件
      currentUser: storage.get(APP_USER), // 登录人信息
      currentDept: storage.get(APP_DEPT), // 登录人部门
      Tp_proctypeEnum: Tp_proctypeEnum,
      loading: false, //按钮显示
      modalVisible: false, // 模态框显示
      labelTitle: '',
    }
  },
  methods: {
    /**
     * 路由重新定向加载
     * @param {} taskid 
     */
    autoToSonRouter(taskid) {
      let params = {
        applyid: this.applyid, // applyid
        proctype: this.proctype, // 操作分类
        userid: this.currentUser.userId,
        username: this.currentUser.fullname,
        processinstanceid: this.processinstanceid, // 流程实例id,
        taskid: taskid
      }
      this.$router.replace({
        // 默认3 操作模式
        query: {
          path: `/HearExamineProcessedOperation/${taskid}/3`,
          url: '/HearExamineHandle',
          queryParam: params
        }
      }, () => {
        this.reload(); //刷新页面
      })
    },
  }
}